<?php
session_start();

include ('headerforsuggestion.php');
 //include('databaseconnection.php');
 $email=$_SESSION['email'];
 //$sugg=$_POST['butt1'];

//$term=$_POST['butt'];

if(isset ($_GET['lis'])){
                $word= $_GET['lis'];
            }
$arrr=explode('.',$word);
			$term= $arrr[0];
			$sugg=$arrr[1];
			$votes=$arrr[2];
		
		echo   "<table width='100%' align='left'>";
		echo "<td width='6%' align='right'><a href='votesofsugg.php?err=$term.$sugg'>".$votes."</a> <font color='green'> votes</font></td>";

$resultlike=mysql_query("SELECT * FROM likesuggestion where email='$email' AND term='$term' AND suggestion='$sugg' ");
if(!$resultlike) echo "invalid";
if (mysql_num_rows($resultlike) >= 1) 
  {
$like='Unlike';
echo "<td width='2%' align='left'><font color='green'> and You like this,  <a href='likesuggestion.php?lis=$term.$sugg.$like'> Unlike</a></td>";
}
else
{
$like='like';
echo "<td width='2%' align='left'><input type='image' name='image' src='bullet.gif'/ height='20' width='20'><a href='likesuggestion.php?lis=$term.$sugg.$like'> like</a></td>";
}

echo "</table>";
	
	$result=mysql_query("SELECT * FROM suggestions WHERE term='$term'and suggestion='$sugg'");
echo   "<table width='100%' height='82' border='1' class='table' align='left'>";

while($row=mysql_fetch_array($result))
{
echo "<form action='commentsugg.php' method='POST'>";

$term=$row['term'];
echo "<tr><td>Term:</td><td>".$row['term']."<input type='hidden' name='butt' value='$term'></td></tr>";

echo "<tr><td>Domain:</td><td>".$row['domain']."</td></tr>";
$sugg=$row['suggestion'];
echo "<tr><td>Suggestion:</td><td>".$row['suggestion']."<input type='hidden' name='butt1' value='$sugg'></td></tr>";
echo "<tr><td>Language:</td><td>".$row['language']."</td></tr>";
echo "<tr><td>Status:</td><td>".$row['status']."</td></tr>";
echo "<tr><td>Suggested by:</td><td>".$row['suggested_by']."</td></tr>";
echo "<tr><td>Suggested Date:</td><td>".$row['suggested_date']."</td></tr>";
echo "<tr><td>Comments:</td><td>".$row['comments']."</td></tr>";
echo  "<tr><td>Add Comments:</td><td><textarea class='ckeditor' name='message' cols='45' rows='5'></textarea>
<input type='hidden' name='votes' value='$votes'><input type='submit' value='Comment' /></td></tr>";
echo "</form>";
$result1 = mysql_query("SELECT * FROM system_user WHERE email='$email' ");
  if (mysql_num_rows($result1) == 1) 
  {
 echo "<form action='changesuggtype.php' method='POST'>";
 echo "<input type='hidden' name='butt' value='$term'>";
 echo "<input type='hidden' name='butt1' value='$sugg'>";
 echo " <input type='hidden' name='votes' value='$votes'>";
echo "<tr><td>Change Status:</td><td><Select name='addsugg'>
<Option value='null'> </Option>
										<Option value='1'>To Be Discussed</Option>
										<Option value='2'>accepted</Option>
										</Select><input type='submit' name='$term' value='Changestatus'/><input type='hidden' name='butt' value='$term'<input type='hidden' name='butt' value='$term'</td></tr>";
echo "</form>";
}
}	
	echo "</table>";
//}



include ('footer.php');
?>
